package database;

import java.sql.Timestamp;
import java.util.List;

import model.Recipe;


/**
 * @author Natalie
 *
 */
public interface DatabaseM3 {
     
    /**
     * @param UserID The user whose recipes will be returned
     * @return A list of the Users favorite recipes
     */
    public List<Recipe> getFavoriteRecipes(String UserID);
    
    /**
     * @param UserID The user whose recently viewed recipes will be returned
     * @return A list of the users recently viewed recipes 
     */
    public List<Recipe> getRecentlyViewedRecipes(String UserID);
    
    /**
     * @param RecipeID The ID of the recipe whose information will be returned
     * @return A list in the form {RecipeAttribute, value, RecipeAttribute, value, ...} containing all non-null values of
     *  the recipe
     */
    public List<String> getRecipeInformation(int RecipeID);
    
    /**
     * @param UserID The ID of the User whose information will be returned
     * @return A list in the form {RecipeAttribute, value, RecipeAttribute, value, ...} containing all non-null values of
     *  the User
     */
    public List<String> getUserInformation(String UserID);
    
    /**
     * @param type the type of values to be returned
     * @param attribute the attribute within the type that will be returned
     * @return A list of all specific attribute values of the type
     */
    public List<String> getStaticValues(String type, String attribute);
    
    /**
     * @param newRecipe List in the form {RecipeAttribute, Value, RecipeAttribute, Value,... } containing
     *  all the values of the new recipe. Recipe_ID is auto-generated and need not be added. 
     * @param ingredients List in the form {{Description, Style_Prep, Unit, Quantity}, 
     * 										{Description, Style_Prep, Unit, Quantity}...}
     * @param steps List in the form {step1, step2, step3, ...}
     * @return True if the operation was successful, false if it failed
     */
    public Boolean addRecipe(List<String> recipeInformation, List<List<String>> ingredients, List<String> steps);
    
    /**
     * @param userID The user whose favorite will be added
     * @param favorite The recipe that will be added as a favorite
     * @return True if the recipe is successfully added as the Users favorite
     */
    public Boolean addFavorite(String userID, Recipe favorite);
   
    /**
     * @param userInformation A list in the form {User_ID, Name, Password}
     * @return True if the User is successfully added
     */
    public Boolean addUser(List<String> userInformation);
    
    /**
     * @param userID The user whose view you want to add
     * @param recipeID The id of the recipe the user viewed
     * @param currentTime The time that the recipe is viewed
     * @return True if the view was added successfully
     */
    public Boolean addRecentView(String userID, String recipeID, Timestamp currentTime);
    
    /**
     * @param recipeID The id of the recipe that was viewed
     * @return True if the view was added successfully
     */
    public Boolean addRecipeView(int recipeID);
    
    /**
     * @param userID The user who wants to unfavorite a recipe
     * @param recipeID The recipe that will be removed from the users favorites
     */
    public void removeFavorite(String userID, int recipeID);
    
    /**
     * @param userID The user's id
     * @param password The user's password
     * @return True if this is a valid user/password combination
     */
    public Boolean validateUser(String userID, String password);
    
    /**
     * @param recipeInformation A list of values to be updated in the form {RecipeAttribute, value, RecipeAttribute, value, ...} where the value is that
     *  corresponding to the attribute listed one position previously in the list. For any attribute that is listed more than once, an arbitrary one will be chosen. 
     * @param recipeID The recipe to be updated
     * @param ingredients All of the recipes ingredients (updated or not)
     * @param steps All of the recipes steps (updated or not)
     * @return True if the operation was successful, false if it failed
     */
    public Recipe editRecipe(int recipeID, List<String> recipeInformation, List<List<String>> ingredients, List<String> steps);
    
    /**
     * @param conditions ArrayList in the form {RecipeAttribute, value, RecipeAttribute, value, ...} where the value is that
     *  corresponding to the attribute listed one position previously in the list
     *  Valid RecipeAttributes are SEARCHSTRING, Cooking_Time, Prep_Time, Cuisine, Course, Difficulty
     * @return A list of the recipes matching these search conditions
     */
    public List<Recipe> searchRecipes(List<String> conditions);   
    
    /**
     * @param recipe A recipe 
     * @param userID A user
     * @return True if the recipe is one of the users favorites. False if it is not. 
     */
    public Boolean isFavorite(int recipe, String userID);
    
}